package day04;


public class MyStack {
    int[] data = new int[10000];
    int top = -1;

    void push(int x) {
        data[++top] = x;
    }

    int peek() {
        return data[top];
    }

    void pop() {
        --top;
    }

    int size() {
        return top + 1;

    }

    boolean empty() {
        return top == -1;
    }

    public static void main(String[] args) {
        MyStack stack = new MyStack();//FILO
        for (int i = 0; i < 10; i++) {
            stack.push(i);
        }
        while (!stack.empty()) {
            System.out.println(stack.peek());
            stack.pop();

        }

    }
}